<template>
  <div class="certificate-view">
    <h1>证书详情</h1>
    <div v-if="certificate">
      <h2>{{ certificate.name }} - {{ certificate.title }}</h2>
      <!-- 这里使用PDF查看器或对象URL来展示PDF -->
      <embed :src="certificate.pdfUrl" type="application/pdf" width="100%" height="600px">
    </div>
    <div v-else>
      <p>证书不存在或无法获取</p>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      certificate: null
    }
  },
  created() {
    this.fetchCertificate()
  },
  methods: {
    async fetchCertificate() {
      // const { certificateId } = this.$route.params
      try {
        const response = await certificateId()
        this.certificate = response.data
      } catch (error) {
        console.error(error)
      }
    }
  }
}
</script>
